<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.js"></script>
    <script src="./runner.js"></script>
</head>
<body>
    <script>
        // generator函数配合 yield 完美处理异步回调地狱
        // promise只能解决异步回调，没有异步逻辑的情况
        runner(function *(){
            let data1 = yield $.ajax({url: 'data/1.txt', dataType: 'json'});
            let data2 = yield $.ajax({url: 'data/2.txt', dataType: 'json'});
            let data3 = yield $.ajax({url: 'data/3.txt', dataType: 'json'});
            
            console.log(data1, data2, data3);
        });

    </script>
</body>
</html>